<?php

/**
 * Semaine filter form base class.
 *
 * @package    sop
 * @subpackage filter
 * @author     Your name here
 */
abstract class BaseSemaineFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'total'       => new sfWidgetFormFilterInput(),
      'commentaire' => new sfWidgetFormFilterInput(),
      'date_lundi'  => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'worker_id'   => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'total'       => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'commentaire' => new sfValidatorPass(array('required' => false)),
      'date_lundi'  => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'worker_id'   => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
    ));

    $this->widgetSchema->setNameFormat('semaine_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Semaine';
  }

  public function getFields()
  {
    return array(
      'total'       => 'Number',
      'commentaire' => 'Text',
      'date_lundi'  => 'Date',
      'worker_id'   => 'Number',
      'id'          => 'Number',
    );
  }
}
